<template>
  <div id="InterviewList">
    <el-table :data="interviewList" border highlight-current-row fit>
      <el-table-column type="index" :label="$t('index')" width="70" align="center"></el-table-column>
      <el-table-column prop="company_name" label="公司名称" align="center" show-overflow-tooltip></el-table-column>
      <el-table-column prop="job_title" label="职位名称" align="center" show-overflow-tooltip></el-table-column>
      <el-table-column prop="interview_place" label="面试地点" align="center" show-overflow-tooltip></el-table-column>
      <el-table-column prop="interview_time" label="面试时间" align="center" show-overflow-tooltip></el-table-column>
      <el-table-column prop="upstring_time" label="通知时间" align="center" show-overflow-tooltip></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-tooltip class="item" effect="light" content="接收" placement="top">
            <i class="fa fa-check-circle icon-style" @click="Operation(scope.row,2)"></i>
          </el-tooltip>
          <el-tooltip class="item" effect="light" content="拒绝" placement="top">
            <i class="fa fa-times icon-style" @click="Operation(scope.row,3)"></i>
          </el-tooltip>
          <el-tooltip class="item" effect="light" content="忽略" placement="top">
            <i class="fa fa-stop-circle-o icon-style" @click="Operation(scope.row,4)"></i>
          </el-tooltip>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @current-change="handleCurrentChange" layout="total,prev,pager,next" :total="total"
                   class="table-page-style"></el-pagination>
  </div>
</template>

<script>
  import { postDataToServer } from '../../assets/js/post.js'
  import { getStaticMapList } from '../../assets/js/GlobeDefine.js'

  export default {
    name: 'InterviewList',
    props: ['status'],
    data () {
      return {
        interviewList: [],
        total: 0,
        page_no: 1
      }
    },
    created () {
      this.getInterviewList()
    },
    methods: {
      handleCurrentChange (pageNum) {
        this.page_no = pageNum
      },
      getInterviewList (pageNum) {
        let _this = this
        let params = new Object()
        params.page_no = _this.page_no
        params.page_size = 20
        params.type = 0
        if (_this.status !== 5) {
          params.status = _this.status
        }
        postDataToServer('HM_PERSONAL_INTERVIEW_LISTPAGE', params)
          .then((data) => {
            if (data.status === 0) {
              _this.interviewList = data.data_list
              _this.total = data.total_results
            } else {
              commonNotify(_this, 1, 'GET')
            }
          }).catch((error) => {
          commonNotify(_this, 1, 'GET')
        })
      },
      Operation (data, status) {
        let _this = this
        let params = new Object()
        params.status = status
        params.id = data.id
        postDataToServer('HM_PERSONAL_INTERVIEW_EDIT', params)
          .then((data) => {
            if (data.status === 0) {
              _this.getInterviewList()
              _this.$emit('ViewState', true)
            }
          })
      }
    }
  }
</script>

<style scoped>
  .icon-style {
    font-size: 20px;
    color: #20a0ff;
    margin: 5px;
    cursor: pointer;
  }
</style>
